<?php

namespace App\Http\Controllers\App;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Models\LinesLog;
use App\Models\Lines;
use App\Models\Queue;
/**
 * 队列订单管理控制器
 */
class LinesController extends Controller
{
    /**
     * 队列列表(GET) api/lines/linesLists
     * 
     * @return json
     */
    public function linesLists(Request $request)
    {        
        $shop_id = $request->input('shop_id');
        if(!$shop_id){
            return self::error('商户id缺省');
        }

        $data = Lines::where('delivery_point',$shop_id)
                ->where('status','!=',0)
                ->paginate(10);
        if(!$data){
            return self::error('数据为空');
        }

        return self::json($data);
    }

    /**
     * 队列详情(GET) api/lines/queueInfo
     *
     * @return json
     */
    public function queueInfo(Request $request)
    {
        $shop_id = $request->input('shop_id');
        if(!$shop_id){
            return self::error('商户id缺省');
        }

        $info = Queue::where('shop_id',$shop_id)->first();
        if(!$info){
            return self::error('数据为空');
        }

        return self::json($info);
    }

    

}
